package com.blb.community;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.util.Arrays;
import java.util.Collections;

/**
 * @Author 帅帅
 * @Date 2022/7/2 11:34
 * @PackageName:com.example.mybatiscode
 * @ClassName: code
 * @Description: TODO
 * @Version 1.0
 */
public class code {
    public static void main(String[] args) {


        FastAutoGenerator.create("jdbc:mysql://121.41.82.94:3306/zy_community?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF-8", "root", "Xia9422.com")
                .globalConfig(builder -> {
                    builder.author("帅帅") // 设置作者
                            .enableSwagger() // 开启 swagger 模式
                            .fileOverride() // 覆盖已生成文件
                            .outputDir("F:/Ideal_work/community/src/main/java/com/blb/community"); // 指定输出目录
                })
                .packageConfig(builder -> {
                    builder.parent("com.blb") // 设置父包名
                            .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "F:/Ideal_work/community/src/main/resources/mapperXml")); // 设置mapperXml生成路径
                })
                .strategyConfig(builder -> {
                    builder.addInclude(Arrays.asList(
                            "sys_area",
                            "sys_config",
                            "sys_dept",
                            "sys_dict_data",
                            "sys_dict_type",
                            "sys_job",
                            "sys_job_log",
                            "sys_logininfor",
                            "sys_menu",
                            "sys_notice",
                            "sys_oper_log",
                            "sys_post",
                            "sys_role",
                            "sys_role_dept",
                            "sys_role_menu",
                            "sys_user",
                            "sys_user_post",
                            "sys_user_role",
                            "zy_building",
                            "zy_comment",
                            "zy_community",
                            "zy_community_interaction",
                            "zy_complaint_suggest",
                            "zy_files",
                            "zy_owner",
                            "zy_owner_room", "zy_owner_room_record",
                            "zy_repair",
                            "zy_room", "zy_unit", "zy_visitor"
                    )) // 设置需要生成的表名
                    ; // 设置过滤表前缀
                })
                .templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板，默认的是Velocity引擎模板
                .execute();
    }
}
